# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=docbook-xml
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=5.0
pkgrel=1
pkgdesc="A widely used XML scheme for writing documentation and help"
arch=('any')
url="https://www.oasis-open.org/docbook/"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-libxml2")
install=docbook-xml-${CARCH}.install
source=('http://docbook.org/xml/5.0/docbook-5.0.zip'
        'http://www.docbook.org/xml/4.5/docbook-xml-4.5.zip'
        'http://www.docbook.org/xml/4.4/docbook-xml-4.4.zip'
        'http://www.docbook.org/xml/4.3/docbook-xml-4.3.zip'
        'http://www.docbook.org/xml/4.2/docbook-xml-4.2.zip'
        'http://www.docbook.org/xml/4.1.2/docbkx412.zip'
        'LICENSE'
        '4.1.2-add-catalog.all.patch'
        '4.2-Add-system.all.patch'
        '4.3-Add-system-and-htmltbl.all.patch')
noextract=('docbook-5.0.zip', 'docbook-xml-4.5.zip' 'docbook-xml-4.4.zip' 'docbook-xml-4.3.zip' 'docbook-xml-4.2.zip' 'docbkx412.zip')
sha256sums=('3dcd65e1f5d9c0c891b3be204fa2bb418ce485d32310e1ca052e81d36623208e'
            '4e4e037a2b83c98c6c94818390d4bdd3f6e10f6ec62dd79188594e26190dc7b4'
            '02f159eb88c4254d95e831c51c144b1863b216d909b5ff45743a1ce6f5273090'
            '23068a94ea6fd484b004c5a73ec36a66aa47ea8f0d6b62cc1695931f5c143464'
            'acc4601e4f97a196076b7e64b368d9248b07c7abf26b34a02cca40eeebe60fa2'
            '30f0644064e0ea71751438251940b1431f46acada814a062870f486c772e7772'
            'adf79c0ee42b5b0d9b0d10def6aca4f7c97a0ce7333b3012af2c929e1ed72b77'
            '100b85e6b1f4b676765ad718d6f75e4f85b921376282f368e1131774ba29e491'
            '323de7ae4c74f6eaba3d41c4b6a312b140b40d39ad93ae8dd3fa9e88bcfd079b'
            '93d3267fa285d7f16aec93392b032d8b8043f3d3779708a3859671e11a3ffed3')

package() {
  # export MSYS2_ARG_CONV_EXCL="-//OASIS"
  for ver in 4.2 4.3 4.4 4.5; do
    rm -rf docbook-xml-${ver} || true
    mkdir docbook-xml-${ver}
    pushd docbook-xml-${ver}
      /usr/bin/bsdtar xf "${srcdir}/docbook-xml-${ver}.zip"
      case $ver in
        4.2)
        patch -p1 -i ${srcdir}/4.2-Add-system.all.patch
      ;;
        4.3)
        patch -p1 -i ${srcdir}/4.3-Add-system-and-htmltbl.all.patch
      ;;
      4.4)
      ;;
      4.5)
      ;;
      esac
      rm -rf "${pkgdir}${MINGW_PREFIX}/share/xml/docbook/xml-dtd-${ver}" || true
      mkdir -p "${pkgdir}${MINGW_PREFIX}/share/xml/docbook/xml-dtd-${ver}"
      cp -dRf docbook.cat *.dtd ent/ *.mod \
      "${pkgdir}${MINGW_PREFIX}/share/xml/docbook/xml-dtd-${ver}/"
    popd
  done

  #extract v4.1.2
  rm -rf docbook-xml-4.1.2 || true
  mkdir docbook-xml-4.1.2
  pushd docbook-xml-4.1.2
    /usr/bin/bsdtar xf "${srcdir}/docbkx412.zip"
    patch -p1 -i ${srcdir}/4.1.2-add-catalog.all.patch
    mkdir -p "${pkgdir}${MINGW_PREFIX}/share/xml/docbook/xml-dtd-4.1.2"
    cp -dRf docbook.cat *.dtd ent/ *.mod \
    "${pkgdir}${MINGW_PREFIX}/share/xml/docbook/xml-dtd-4.1.2/"
  popd

  #extract v5.0
  rm -rf docbook-xml-5.0 || true
  mkdir docbook-xml-5.0
  pushd docbook-xml-5.0
    /usr/bin/bsdtar xf "${srcdir}/docbook-5.0.zip"
    mkdir -p "${pkgdir}${MINGW_PREFIX}/share/xml/docbook/xml-dtd-5.0"
    #cp -dRf docbook-5.0/catalog.xml docbook-5.0/xsd/*.xsd docbook-5.0/sch/docbook.sch docbook-5.0/dtd/docbook.dtd  \   
    cp -dRf \
      docbook-5.0/catalog.xml \
      docbook-5.0/xsd/ \
      docbook-5.0/sch/ \
      docbook-5.0/dtd/ \
      docbook-5.0/rng/ \
    "${pkgdir}${MINGW_PREFIX}/share/xml/docbook/xml-dtd-5.0/"
  popd

  mkdir -p "${pkgdir}${MINGW_PREFIX}/etc/xml"
  ${MINGW_PREFIX}/bin/xmlcatalog --noout --create "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  # V4.1.2
  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML V4.1.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML CALS Table Model V4.1.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/calstblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML CALS Table Model V4.1.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/calstblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/soextblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML Information Pool V4.1.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/dbpoolx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.1.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/dbhierx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.1.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/dbgenent.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Notations V4.1.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/dbnotnx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Character Entities V4.1.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.1.2/dbcentx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteSystem" \
    "http://www.oasis-open.org/docbook/xml/4.1.2" \
    "../../share/xml/docbook/xml-dtd-4.1.2" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteURI" \
    "http://www.oasis-open.org/docbook/xml/4.1.2" \
    "../../share/xml/docbook/xml-dtd-4.1.2" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  # V4.2
  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML V4.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook CALS Table Model V4.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.2/calstblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
    "http://www.oasis-open.org/docbook/xml/4.2/soextblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook Information Pool V4.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.2/dbpoolx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.2/dbhierx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Additional General Entities V4.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.2/dbgenent.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Notations V4.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.2/dbnotnx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Character Entities V4.2//EN" \
    "http://www.oasis-open.org/docbook/xml/4.2/dbcentx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteSystem" \
    "http://www.oasis-open.org/docbook/xml/4.2" \
    "../../share/xml/docbook/xml-dtd-4.2" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteURI" \
    "http://www.oasis-open.org/docbook/xml/4.2" \
    "../../share/xml/docbook/xml-dtd-4.2" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  # V4.3
  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML V4.3//EN" \
    "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook CALS Table Model V4.3//EN" \
    "http://www.oasis-open.org/docbook/xml/4.3/calstblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
    "http://www.oasis-open.org/docbook/xml/4.3/soextblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook Information Pool V4.3//EN" \
    "http://www.oasis-open.org/docbook/xml/4.3/dbpoolx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.3//EN" \
    "http://www.oasis-open.org/docbook/xml/4.3/dbhierx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Additional General Entities V4.3//EN" \
    "http://www.oasis-open.org/docbook/xml/4.3/dbgenent.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Notations V4.3//EN" \
    "http://www.oasis-open.org/docbook/xml/4.3/dbnotnx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Character Entities V4.3//EN" \
    "http://www.oasis-open.org/docbook/xml/4.3/dbcentx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteSystem" \
    "http://www.oasis-open.org/docbook/xml/4.3" \
    "../../share/xml/docbook/xml-dtd-4.3" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteURI" \
    "http://www.oasis-open.org/docbook/xml/4.3" \
    "../../share/xml/docbook/xml-dtd-4.3" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  # V4.4
  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML V4.4//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook CALS Table Model V4.4//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/calstblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.4//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/htmltblx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/soextblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook Information Pool V4.4//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/dbpoolx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.4//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/dbhierx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Additional General Entities V4.4//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/dbgenent.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Notations V4.4//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/dbnotnx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"
  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook Character Entities V4.4//EN" \
    "http://www.oasis-open.org/docbook/xml/4.4/dbcentx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteSystem" \
    "http://www.oasis-open.org/docbook/xml/4.4" \
    "../../share/xml/docbook/xml-dtd-4.4" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteURI" \
    "http://www.oasis-open.org/docbook/xml/4.4" \
    "../../share/xml/docbook/xml-dtd-4.4" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  # V4.5
  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML V4.5//EN" \
    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/calstblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/soextblx.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/dbpoolx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/dbhierx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/htmltblx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/dbnotnx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/dbgenent.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteSystem" \
    "http://www.oasis-open.org/docbook/xml/4.5" \
    "../../share/xml/docbook/xml-dtd-4.5" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteURI" \
    "http://www.oasis-open.org/docbook/xml/4.5" \
    "../../share/xml/docbook/xml-dtd-4.5" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  # 5.0
  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML 5.0//EN" \
    "http://docbook.org/xml/5.0/dtd/docbook.dtd" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \
    "../../share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteSystem" \
    "http://www.oasis-open.org/docbook/xml/5.0" \
    "../../share/xml/docbook/xml-dtd-5.0" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteSystem" \
    "http://docbook.org/xml/5.0" \
    "../../share/xml/docbook/xml-dtd-5.0" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteURI" \
    "http://www.oasis-open.org/docbook/xml/5.0" \
    "../../share/xml/docbook/xml-dtd-5.0" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  ${MINGW_PREFIX}/bin/xmlcatalog --noout --add "rewriteURI" \
    "http://docbook.org/xml/5.0/" \
    "../../share/xml/docbook/xml-dtd-5.0" \
    "${pkgdir}${MINGW_PREFIX}/etc/xml/docbook-xml"

  # license
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
